<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="getSession.jsp" %>
<%
	//step:设置编码格式
	request.setCharacterEncoding("utf-8");
	//step:获取表单数据
	String id = request.getParameter("id");
	String name = request.getParameter("studentname");
	String gender = request.getParameter("gender");
	String age = request.getParameter("age");
	String no = request.getParameter("studentno");
	String address= request.getParameter("address");
	String tel = request.getParameter("tel");
	String cid = request.getParameter("classid");
	
	
	//step3:数据库操作
	DBHelper helper = new DBHelper();
	
	String sql="update studentinfo set studentname=?,gender=?,age=?,studentno=?,address=?,telphone=?,classid=? where studentid=?";
	
	
	int i  = helper.executeSQL(sql, name,gender,age,no,address,tel,cid,id);
	
	helper.close();
	if(i==0){
		%>
		<script type="text/javascript">
			alert("修改失败，请重新修改");
			window.location.href="modify.jsp?id="+id
		</script>
		<%
	}else{
		%>
		<script type="text/javascript">
		alert("修改成功");
		window.location.href="student_list.jsp"
		</script>
	<%}
	
	%>
	
	
	
